home *** CD-ROM | disk | FTP | other *** search
- function onLoad()
- {
- if(typeof _root.instanceID == "undefined")
- {
- contents.obj.setSize(Stage.width,Stage.height);
- }
- }
- function nextChar()
- {
- return str.charAt(strIndex);
- }
- function isSpace(ch)
- {
- return ch == " " || ch == "\t" || ch == "\r" || ch == "\n";
- }
- function trimSpaces(s)
- {
- var _loc1_ = undefined;
- var _loc3_ = undefined;
- _loc1_ = 0;
- while(_loc1_ < s.length)
- {
- if(!isSpace(s.charAt(_loc1_)))
- {
- break;
- }
- _loc1_ = _loc1_ + 1;
- }
- _loc3_ = s.length;
- while(_loc3_ > 0)
- {
- if(!isSpace(s.charAt(_loc3_ - 1)))
- {
- break;
- }
- }
- return s.substring(_loc1_,_loc3_);
- }
- function skipSpaces()
- {
- var _loc1_ = undefined;
- while(isSpace(nextChar()))
- {
- strIndex++;
- }
- }
- function parseArray()
- {
- var _loc3_ = [];
- skipSpaces();
- if(nextChar() == "]")
- {
- strIndex++;
- return _loc3_;
- }
- while(true)
- {
- skipSpaces();
- var _loc2_ = parse();
- _loc3_.push(_loc2_);
- skipSpaces();
- var _loc1_ = nextChar();
- if(_loc1_ == "]")
- {
- strIndex++;
- break;
- }
- if(_loc1_ != ",")
- {
- break;
- }
- strIndex++;
- }
- return _loc3_;
- }
- function parseObject()
- {
- var _loc5_ = {};
- skipSpaces();
- var _loc2_ = nextChar();
- if(_loc2_ == undefined)
- {
- return _loc5_;
- }
- if(_loc2_ == "}")
- {
- strIndex++;
- return _loc5_;
- }
- while(true)
- {
- skipSpaces();
- var _loc1_ = str.indexOf(":",strIndex);
- if(_loc1_ == -1)
- {
- break;
- }
- var _loc4_ = str.substring(strIndex,_loc1_);
- strIndex = _loc1_ + 1;
- var _loc3_ = parse();
- _loc5_[_loc4_] = _loc3_;
- skipSpaces();
- _loc2_ = nextChar();
- if(_loc2_ == "}")
- {
- strIndex++;
- break;
- }
- if(_loc2_ != ",")
- {
- break;
- }
- strIndex++;
- }
- return _loc5_;
- }
- function parseString()
- {
- var _loc2_ = "";
- var _loc1_ = undefined;
- while((_loc1_ = str.indexOf("\'",strIndex)) != -1)
- {
- if(str.charAt(_loc1_ - 1) != "\\")
- {
- break;
- }
- _loc2_ += str.substring(strIndex,_loc1_ - 1);
- _loc2_ += "\'";
- strIndex = _loc1_ + 1;
- }
- _loc2_ += str.substring(strIndex,_loc1_);
- strIndex = _loc1_ + 1;
- return _loc2_;
- }
- function parse()
- {
- skipSpaces();
- var _loc1_ = nextChar();
- if(_loc1_ == "{")
- {
- strIndex++;
- return parseObject();
- }
- if(_loc1_ == "[")
- {
- strIndex++;
- return parseArray();
- }
- if(_loc1_ == "\'")
- {
- strIndex++;
- return parseString();
- }
- var _loc2_ = strIndex;
- while(true)
- {
- _loc1_ = str.charAt(_loc2_);
- if(_loc1_ == undefined || _loc1_ == "}" || _loc1_ == "]" || _loc1_ == ",")
- {
- break;
- }
- _loc2_ = _loc2_ + 1;
- }
- var _loc3_ = trimSpaces(str.substring(strIndex,_loc2_));
- strIndex = _loc2_;
- if(_loc3_.charAt(0) == "#" && _loc3_.length == 7)
- {
- _loc3_ = "0x" + _loc3_.substring(1,7);
- }
- if(_loc3_ == "true")
- {
- return true;
- }
- if(_loc3_ == "false")
- {
- return false;
- }
- return Number(_loc3_);
- }
- function onSizeMulti()
- {
- var _loc3_ = "instance" + _root.instanceID;
- var _loc2_ = contents[_loc3_];
- _root.instanceWidth = Number(_root.instanceWidth);
- _root.instanceHeight = Number(_root.instanceHeight);
- if(_loc2_.width != _root.instanceWidth || _loc2_.height != _root.instanceHeight)
- {
- _loc2_.setSize(_root.instanceWidth,_root.instanceHeight);
- if(typeof _loc2_._livePreviewMask == "undefined")
- {
- _loc2_._livePreviewMask = _root.createEmptyMovieClip("_livePreviewMask" + instanceID,1);
- _loc2_.setMask(_loc2_._livePreviewMask);
- }
- _loc2_._livePreviewMask.clear();
- _loc2_._livePreviewMask.beginFill(0,100);
- _loc2_._livePreviewMask.moveTo(0,0);
- _loc2_._livePreviewMask.lineTo(_root.instanceWidth,0);
- _loc2_._livePreviewMask.lineTo(_root.instanceWidth,_root.instanceHeight);
- _loc2_._livePreviewMask.lineTo(0,_root.instanceHeight);
- _loc2_._livePreviewMask.lineTo(0,0);
- _loc2_._livePreviewMask.endFill();
- _loc2_._visible = true;
- _loc2_._x = 0;
- _loc2_._y = 0;
- }
- }
- function onDrawMulti()
- {
- if(_root.visibleID != _root.instanceID)
- {
- contents.obj._visible = false;
- if(typeof _root.visibleID != "undefined")
- {
- contents["instance" + _root.visibleID]._visible = false;
- }
- contents["instance" + _root.instanceID]._visible = true;
- _root.visibleID = _root.instanceID;
- }
- }
- function onUpdateMulti()
- {
- var _loc6_ = "instance" + _root.instanceID;
- if(!contents[_loc6_])
- {
- var _loc5_ = {};
- for(var _loc8_ in xch)
- {
- var _loc2_ = String(_loc8_);
- if(_loc2_.indexOf("def_",0) == 0)
- {
- _loc2_ = _loc2_.substring(4);
- }
- _loc5_[_loc2_] = xch[_loc8_];
- }
- contents.obj.duplicateMovieClip(_loc6_,_root.instanceID + 100,_loc5_);
- contents[_loc6_]._visible = false;
- }
- else
- {
- var _loc3_ = contents[_loc6_];
- for(_loc8_ in xch)
- {
- _loc2_ = String(_loc8_);
- if(_loc2_.indexOf("def_",0) == 0)
- {
- _loc2_ = _loc2_.substring(4);
- }
- _loc3_[_loc2_] = xch[_loc8_];
- }
- if(_root.flashlet)
- {
- str = unescape(_root.flashlet);
- strIndex = 0;
- var _loc4_ = parse();
- for(var _loc7_ in _loc4_)
- {
- _loc3_[_loc7_] = _loc4_[_loc7_];
- }
- }
- _loc3_.onUpdate();
- }
- }
- function onUpdate()
- {
- if(typeof _root.instanceID != "undefined")
- {
- return onUpdateMulti();
- }
- for(var _loc5_ in xch)
- {
- var _loc2_ = String(_loc5_);
- if(_loc2_.indexOf("def_",0) == 0)
- {
- _loc2_ = _loc2_.substring(4);
- }
- contents.obj[_loc2_] = xch[_loc5_];
- }
- if(_root.flashlet)
- {
- str = unescape(_root.flashlet);
- strIndex = 0;
- var _loc3_ = parse();
- for(var _loc4_ in _loc3_)
- {
- contents.obj[_loc4_] = _loc3_[_loc4_];
- }
- }
- contents.obj.onUpdate();
- }
- Stage.align = "TL";
- Stage.scaleMode = "noScale";
- listen = new Object();
- Stage.addListener(listen);
- _global.isLivePreview = true;
- listen.onResize = function()
- {
- if(typeof _root.instanceID == "undefined")
- {
- contents.obj.setSize(Stage.width,Stage.height);
- }
- };
- if(_root.flashlet)
- {
- onUpdate();
- }
-